<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
	function checkForm(){
		var userCode = document.getElementById("userCode");
		var userName = document.getElementById("userName");
		var roleId = document.getElementById("roleId");
		
		if(userCode.value == ""){
			alert("用户编码不能为空！");
			return false;
		}
		if(userName.value == ""){
			alert("用户名称不能为空！");
			return false;
		}
		if(roleId.value == 0){
			alert("请指定角色！");
			return false;
		}
		return true;
	}

	function back(){
		window.location.href = "userManage.html";
		window.location.target = "main";
	}
	
	function save(){
		if(checkForm()){
			document.addUserForm.action = "./user.do?action=addUser";
			document.addUserForm.target = "main";
			document.addUserForm.submit();
		}
	}
	
	function uploadFile(){
		document.uploadForm.action = "./upload.do";
		document.uploadForm.target = "main";
		document.uploadForm.submit();
	}
	
-->
</script>
</head>
<body>
	<a class="common_title">您现在的位置：基础设置 >> 新增用户</a>
	
	<div class="tools">
		<a class="save" href="javascript:save();" title="保存" hidefocus="true">保存</a>&nbsp;&nbsp;
		<a class="reset" href="#" title="重置" hidefocus="true">重置</a>&nbsp;&nbsp;
		<a class="back" href="javascript:back();" title="返回" hidefocus="true">返回</a>&nbsp;&nbsp;
	</div>
	
<table class="table1">
	<tr>
		<td>
		<form name="addUserForm" action="" method="post">
			<table class="table_input" cellpadding="0" cellspacing="0" style="margin: 0 0 0 100px;">
				<tr>
					<td width="20%">用户编号：</td>
					<td><input id="userCode" name="userCode" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">用户姓名：</td>
					<td><input id="userName" name="userName" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">用户密码：</td>
					<td><input id="password" name="password" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">确认密码：</td>
					<td><input id="password2" name="password2" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">所属部门：</td>
					<td>
						<select id="deptId" name="deptId">
							<option>--------请选择--------</option>
							<option>销售部</option>
							<option>市场部</option>
						</select>
					</td>
				</tr>
				<tr>
					<td width="20%">指定角色：</td>
					<td>
						<select id="roleId" name="roleId">
							<option value="0">--------请选择--------</option>
							<c:forEach var="role" items="${roles}">
							<option value="${role.id}">${role.roleName}</option>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<td width="20%">分机：</td>
					<td><input id="phone" name="phone" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">手机：</td>
					<td><input id="mobile" name="mobile" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">出生日期：</td>
					<td><input id="birthday" name="birthday" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">Email：</td>
					<td><input id="email" name="email" class="input1" type="text"/></td>
				</tr>
				<tr>
					<td width="20%">是否可用：</td>
					<td colspan="3"><input id="activity" name="activity" type="radio" checked="checked"/>是&nbsp;&nbsp;<input id="activity" name="activity" type="radio"/>否</td>	
				</tr>
			</table>
		</form>
		<!-- upload  enctype="multipart/form-data"-->
		<form id="uploadForm" name="uploadForm" method="post" action="./upload.do" >
			<table class="table_input" cellpadding="0" cellspacing="0" style="margin: 0 0 0 100px;">
				<tr>
					<td width="20%" rowspan="2" style="height: 60px;">附件：</td>
					<td>
						<select style="width: 75%">
							<option>请选择</option>
							<c:forEach var="ufile" items="${fileList}">
								<option>${ufile}</option>
							</c:forEach>
						</select>&nbsp;
						<input class="btn1" type="button" value=" 删 除 " onclick="">
					</td>
				</tr>
				<tr>
					<td>
						<input id="contents" name="contents" type="file" style="width: 75%"/>&nbsp;
						<input class="btn1" type="submit" value=" 上 传 ">
					</td>
				</tr>
				<tr>
					<td>文件名：</td>
					<td><input class="input1" id="fileName" name="fileName" /></td>
				</tr>
			</table>
		</form>
		<%=request.getSession().getServletContext().getRealPath("/") %>
		</td>
	</tr>
</table>
</body>
</html>